﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;


namespace Test_Drag_N_drop
{
    class MessageBox
    {
        private Texture2D wallMsg;
        private Texture2D winMsg;
        private Texture2D noEndMsg;
        private Texture2D noExitMsg;
        protected Texture2D _texture;
        protected Rectangle rectangle;
        protected bool isActive = false;

        public Texture2D Texture
        {
            get { return _texture; }
            set { _texture = value; }
        }

        public Rectangle Rect
        {
            get { return rectangle; }
            set { rectangle = value; }
        }

        public MessageBox(Game1 game)
        {
        }

        public void Initialize(int x, int y)
        {
            rectangle = new Rectangle(x, y, 0, 0);
        }

        public void LoadContent(ContentManager content)
        {
            noEndMsg = content.Load<Texture2D>("endblockmsg");
            noExitMsg = content.Load<Texture2D>("noexit");
            wallMsg = content.Load<Texture2D>("wallmsg");
            winMsg = content.Load<Texture2D>("winmsg");

            _texture = wallMsg;
            rectangle.X = rectangle.X - _texture.Width / 2;
            rectangle.Y = rectangle.Y - _texture.Height / 2;
            rectangle.Width = _texture.Width;
            rectangle.Height = _texture.Height;
        }


        public void Draw(SpriteBatch spriteBatch, GameTime gameTime)
        {
            if (isActive)
            {
                spriteBatch.Draw(_texture, rectangle, Color.White);
            }
        }

        public void setActive(bool b)
        {
            isActive = b;
        }

        public void setMessage(int i)
        {
            switch (i)
            {
                case 4:
                    {
                        _texture = noEndMsg;
                        break;
                    }
                case 1:
                    {
                        _texture = wallMsg;
                        break;
                    }
                case 2:
                    {
                        _texture = noExitMsg;
                        break;
                    }
                case 3:
                    {
                        _texture = winMsg;
                        break;
                    }
            }
        }
    }
}
